<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>VOC-UI Demo</title>
 
<link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/resources/css/start/jquery-ui-1.10.3.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/resources/css/ui.jqgrid.css" />
 
<style>
html, body {
    margin: 0;
    padding: 0;
    font-size: 75%;
}
</style> 
 
<script src="<%=request.getContextPath()%>/resources/js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/resources/js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/resources/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/resources/js/jquery.jqGrid.min.js" type="text/javascript"></script>
 
<script type="text/javascript">
$(document).ready(function() {
	// master grid
	$("#listMstr").jqGrid({
		url: "<%=request.getContextPath()%>/test/jqgrid02/listMstr.json",
		datatype: "json",
		//height: 'auto',
		width:600,
		height: 300,
	   	colNames:['<spring:message code="voc.info.userName2" arguments="가,나"/>'
	   	         ,'COUNTRY_ISO_CODE'
	   	         ,'REGION'],
	   	colModel:[
	   		{name:'COUNTRY',index:'COUNTRY', width:100},
	   		{name:'COUNTRY_ISO_CODE',index:'COUNTRY_ISO_CODE', width:100},		
	   		{name:'REGION',index:'REGION', width:100},
	   	],
		rowNum: 20,
		rowList: [10,20,30],
	   	pager: "#pagerMstr",
	   	viewrecords: true,
	   	sortable : false,
	   	caption: "Master Data",
	   	emptyrecords:"No records to view",
	   	loadonce:true,
	   	onSelectRow: function(rowid) {
	   		//alert($("#listMstr").getRowData(rowid)["COUNTRY"]);
	   		var postData = {
	   			COUNTRY_ISO_CODE:$("#listMstr").getCell(rowid, "COUNTRY_ISO_CODE")
			}; 
			$("#listDtl").jqGrid('setGridParam',{url:"<%=request.getContextPath()%>/test/jqgrid02/listDtl.json"
											   ,datatype: "json", postData: postData})
						.jqGrid('setCaption',"Detail Data: "+rowid)
						.trigger('reloadGrid');
		}
	}).navGrid('#pagerMstr',{add:false,edit:false,del:false});
	
	// detail grid
	$("#listDtl").jqGrid({
	   	url:"",
		datatype: "json",
		width:600,
		height: 150,
	   	colNames:['CITY_ID','CITY_NAME','COUNTRY', 'AIRPORT', 'LANGUAGE','COUNTRY_ISO_CODE'],
	   	colModel:[
	   		{name:'CITY_ID',index:'CITY_ID', width:60, sorttype:"int"},
	   		{name:'CITY_NAME',index:'CITY_NAME', width:55},
	   		{name:'COUNTRY',index:'COUNTRY', width:180},
	   		{name:'AIRPORT',index:'AIRPORT', width:80, align:"right"},
	   		{name:'LANGUAGE',index:'LANGUAGE', width:80, align:"right"},		
	   		{name:'COUNTRY_ISO_CODE',index:'COUNTRY_ISO_CODE', width:80,align:"right", sortable:false, search:false}
	   	],
		rowNum: 20,
		rowList: [10,20,30],
	   	pager: '#pagerDtl',
	    viewrecords: true,
	    sortable : false,
		caption:"Detail Data",
		emptyrecords:"No records to view",
		loadonce:true,
	    multiselect: false,
		
	}).navGrid('#pagerDtl',{add:false,edit:false,del:false});
});	
</script>
</head>

<strong><spring:message code="voc.info.userName2" arguments="가,나"/></strong>
<br></br>
<strong><spring:message code="userName2" arguments="가,나"/></strong>

<body>
	
	<br></br>
    <table id="listMstr"></table> 
    <div id="pagerMstr"></div> 
    <br></br>
    <table id="listDtl"></table>
	<div id="pagerDtl"></div>
</body>
</html>